package com.jqb.usermgr.manager;

import java.util.Date;

import org.hibernate.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.jqb.usermgr.model.Log;
import com.jqb.usermgr.model.User;
import com.jqb.usermgr.util.HibernateUtil;

public class UserManagerImpl extends HibernateDaoSupport implements UserManager {
	private LogManager logManager;
	
	public void setLogManager(LogManager logManager) {
		this.logManager = logManager;
	}

	public void addUser(User user) {
		this.getHibernateTemplate().save(user);
		Log log = new Log();
		log.setTime(new Date());
		log.setType("安全日志");
		log.setDetail(user.getName() + "于" + log.getTime() + "进入系统");
		logManager.addLog(log);
	}
}
